'use strict';

const path = require('path');

module.exports = {
  // 方法拓展
  getPackage(key) {
    const packs = getPackageJSON();
    return key ? packs[key] : packs;
  },


  //   属性拓展
  get allPacks() {
    return getPackageJSON();
  },
};

function getPackageJSON() {
  const filePath = path.join(process.cwd(), 'package.json');
  const pack = require(filePath);
  return pack;
}
